package com.tizona.entity;

import java.util.HashMap;
import java.math.BigDecimal;
import java.sql.Timestamp;

/**
 * Created by Vitaliy Kim.
 * Date: 28.08.2005
 * Time: 15:20:19
 */
public class Split {

    /** identifier field */
    private BigDecimal ssId;

    /** identifier field */
    private Long sessionId;

    /** nullable persistent field */
    private Timestamp start;

    /** nullable persistent field */
    private Timestamp stop;

    /** persistent field */
    private boolean active;

    /** persistent field */
    private Session session;

    public HashMap <Long,TrafficSplit> traffic = new HashMap <Long,TrafficSplit> ();

    public Long getSessionId() {
        return sessionId;
    }

    public void setSessionId(Long sessionId) {
        this.sessionId = sessionId;
    }

    /*Default constructor*/
    public Split() {
    }

    /*Constructor*/
    public Split(Long sessionId, Timestamp start, Timestamp stop, boolean active) {
        this.sessionId = sessionId;
        this.start = start;
        this.stop = stop;
        this.active = active;
    }

    /*Constructor*/
    public Split(BigDecimal ssId, Long sessionId, Timestamp start, Timestamp stop, boolean active) {
        this.ssId = ssId;
        this.sessionId = sessionId;
        this.start = start;
        this.stop = stop;
        this.active = active;
    }

    public BigDecimal getSsId() {
        return ssId;
    }

    public void setSsId(BigDecimal ssId) {
        this.ssId = ssId;
    }

    public Timestamp getStart() {
        return start;
    }

    public void setStart(Timestamp start) {
        this.start = start;
    }

    public Timestamp getStop() {
        return stop;
    }

    public void setStop(Timestamp stop) {
        this.stop = stop;
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public Session getSession() {
        return session;
    }

    public void setSession(Session session) {
        this.session = session;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        final Split split = (Split) o;

        if (active != split.active) return false;
        if (!sessionId.equals(split.sessionId)) return false;
        if (!start.equals(split.start)) return false;
        if (!stop.equals(split.stop)) return false;

        return true;
    }

    public int hashCode() {
        int result;
        result = (ssId != null ? ssId.hashCode() : 0);
        result = 29 * result + sessionId.hashCode();
        result = 29 * result + start.hashCode();
        result = 29 * result + (stop != null ? stop.hashCode() : 0);
        return result;
    }

}
